/*
 *  Memoria paginata
 */

#ifndef SP_MMU_PAGING_H
#define SP_MMU_PAGING_H

#include <klibc/ctype.h>

typedef struct
{
	u_int present    : 1;   // Pagina in memoria?
	u_int rw         : 1;   // Se = 1, rw
	u_int user       : 1;   // Supervisore se e' 0
	u_int accessed   : 1;   // Has the page been accessed since last refresh?
	u_int dirty      : 1;   // Has the page been written to since last refresh?
	u_int unused     : 7;   // Amalgamation of unused and reserved bits
	u_int frame      : 20;  // Frame address (shifted right 12 bits)
} page_t;


typedef page_t page_table[1024];
page_table page_dir[1024];


void pagefault_handler(int, int, int);
void paging_init();
void *paging_map(void *, unsigned);
void paging_unmap(void *);
void *paging_get_phy(void *);

#endif
